/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import model.dao.DanhGiaDAO;
import model.entity.Danhgia;
import model.service.DanhgiaDAOService;

/**
 *
 * @author duy
 */
public class DanhGiaConverter implements Converter{
private final DanhgiaDAOService danhgiaServer = DanhGiaDAO.getInstance();
    @Override
    public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
      return danhgiaServer.getDanhgiabyID(Integer.valueOf(value));

    }

    @Override
    public String getAsString(FacesContext fc, UIComponent uic, Object value) {
        return ((Danhgia)value).getMadanhgia()+"";

    }
    
}
